/**
 * 定义中控数据管理模块
 */
(function(window, angular, undefined){
	var module = angular.module('water.apps.ws.wsclcManager.wsclcInfo.controlDataManager', ['water.entity.controlData']);
	module.controller('controlDataController',function($wdp,$rootScope,$scope,$controlDataService){
		/**
		 * 查询条件
		 */
		$scope.queryObject={};
		/**
		 * 中控数据
		 */
		$scope.controlData={};
		/**
		 * 查询事件
		 */
		$scope.OnQueryClick=function(){
			$scope._getControlDataList();
		};
		/**
		 * 监控污水处理厂id变化
		 */
		if($wdp.viewValue.wwtpDetailParmWatch){
			$wdp.viewValue.wwtpDetailParmWatch();
		}
		$wdp.viewValue.wwtpDetailParmWatch = $rootScope.$watch(function(){return $wdp.viewValue.wwtpDetailParm;},function(){
			if(!$wdp.viewValue.wwtpDetailParm){
				return;
			}
			$scope.queryObject.WWTP_ID = $wdp.viewValue.wwtpDetailParm.WWTPID;
			$scope._getControlDataList();
        },true);
		/**
		 * 获取中控数据数据
		 */
		$scope._getControlDataList=function(){
			$controlDataService.getList($scope.queryObject).then(function(d){
				if(d.data.length < 1){
					$scope.controlData = {};
					return;
				}
				$scope.controlData=d.data;
			});
		};
	});
}(window, angular));